package com.itheima.wms.controller;

import com.itheima.wms.controller.dto.LoginRequest;
import com.itheima.wms.controller.vo.UserInfoVo;
import com.itheima.wms.service.LoginService;
import com.itheima.wms.utils.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(path = "/users/login")
@RequiredArgsConstructor
public class LoginController {

    private final LoginService loginService;

    @PostMapping
    public Result login(@RequestBody LoginRequest request) {
        UserInfoVo login = loginService.login(request);

        return Result.success(login);

    }
}
